package com.jsh.wiki.controller;

import com.jsh.wiki.domain.Test;
import com.jsh.wiki.service.TestService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class TestController {
    @Resource
    private TestService testService;

    @Value("${test.hello:hello}")
    private String name;
    @GetMapping("/hello")
    public String hello(){
        return"Hello word"+name;
    }
    @PostMapping("/hello/post")
    public String hello2(String name){
        return "hello word post"+name;
    }
    @RequestMapping("/list")
    public List<Test> test(){
       return testService.list();

    }
}
